home *** CD-ROM | disk | FTP | other *** search
- /* fstattest.c (c) Copyright 1990 H.Rogers */
-
- /* This program tests the fstat() system call. */
- /* For full information on fstat(), read the appropriate entry
- * in section 2 of the UNIX Programmer's Manual. */
-
- #include <stdio.h> /* standard I/O and UNIX */
- #include <time.h> /* time functions */
-
- #include "sys/stat.h" /* file status */
- #include "unistd.h" /* UNIX system calls */
-
- int main()
- {
- struct stat buf[1]; /* file status structure */
-
- fstat(1,buf); /* get status of terminal */
- printf("dev: %d\n",buf->st_dev);
- printf("ino: %x\n",buf->st_ino);
- printf("mode: %o\n",buf->st_mode);
- printf("nlink: %d\n",buf->st_nlink);
- printf("uid: %d\n",buf->st_uid);
- printf("gid: %d\n",buf->st_gid);
- printf("rdev: %d\n",buf->st_rdev);
- printf("size: %x\n",buf->st_size);
- printf("atime: %s",ctime(&buf->st_atime));
- printf("mtime: %s",ctime(&buf->st_mtime));
- printf("ctime: %s",ctime(&buf->st_ctime));
- }
-